import { get } from '../get'
import { request } from '../request'
import axios from 'axios'
import { SERVER_URL } from '@/util/constant'
import Cookie from 'js-cookie'

// 获取所有数据
export const GetData = (params) => {
  return get.get('/sysmanage/queryAll',
    {params}
  )

}
// 公司名称树状
export const GetCompanyTree = (params) => {
  return get.get('/sysmanage/queryCompanyTree',
    {params}
  )

}
// 查询
export const GetQueryData = (params) => {
  return get.get('/sysmanage/queryByName',
    {params}
  )

}

// 注册
export const RegisterUser = (data) => {
  return request.post('/sysmanage/register',data)

}

// 注销
export const GetLogout = (params) => {
  return get.get('/sysmanage/logout',
    {params}
  )

}

// 角色
export const GetRoles = () => {
  return get.get('/sysmanage/querySysRole'
  )

}

// 创建用户
export const CreateUser = (data) => {
  return request.post('/sysmanage/createMainPerson',data)

}

// 编辑用户
export const EditUser = (code) => {
  return get.get(`/sysmanage/queryMainPerson?code=${code}`)

}

// 编辑提交用户
export const UpdateEdit = (data) => {
  console.log(data, 98)
  return request.post('/sysmanage/updateMainPerson',data)

}

// 删除用户
export const deleteUser = (code) => {
  return request.delete(`/sysmanage/deleteMainPerson?code=${code}`)
}

//查询所有角色（sys_role）信息
export const getQueryAllRole = (num, size) => {
  return get.get(`/sysmanage/queryAllRole?num=${num}&size=${size}`)
}

// 创建角色
export const CreateRoles = (data) => {
  return request.post('/sysmanage/createNewRole',data)

}
// 查询角色
export const GetQueryRole = (params) => {
  return get.get('/sysmanage/queryAllRoleLikeName',
    {params}
  )

}

// 删除用户
export const deleteRole = (id) => {
  return request.delete(`/sysmanage/deleteRole?id=${id}`)
}

// 编辑角色
export const EditRole = (id) => {
  return get.get(`/sysmanage/queryRoleByID?id=${id}`)

}

// 编辑提交角色
export const UpdateRole = (data) => {
  return request.post('/sysmanage/updateRole',data)

}